//
//  UITableView+Cells.m
//  sittone
//
//  Created by LYH on 2022/4/7.
//  Copyright © 2022 store. All rights reserved.
//

#import "UITableView+Cells.h"

@implementation UITableView (Cells)

- (UITableViewCell *)systemCellStyleValue1WithIdentifier:(NSString *)identifier{

    return [self systemCellStyleValue1WithIdentifier:identifier accessoryType:UITableViewCellAccessoryNone];
}

- (UITableViewCell *)systemCellStyleValue1WithIdentifier:(NSString *)identifier accessoryType:(UITableViewCellAccessoryType)accessoryType{
    UITableViewCell *cell = [self dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.textColor = [self colorHex:0x333333];
        cell.textLabel.font = [UIFont systemFontOfSize:16];
        cell.detailTextLabel.textColor = [self colorHex:0x999999];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:16];;
        cell.accessoryType = accessoryType;
    }
    return cell;
}
- (UIColor *)colorHex:(uint32_t)hex{
    return [UIColor colorWithRed:((hex & 0xFF0000) >> 16) / 255.0f
                           green:((hex & 0xFF00) >> 8) / 255.0f
                            blue:(hex & 0xFF) / 255.0f
                           alpha:1];
}

- (UITableViewCell *)systemCellStyleDefaultWithIdentifier:(NSString *)identifier{
    UITableViewCell *cell = [self dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.textLabel.textColor = [self colorHex:0x999999];;
        cell.textLabel.font = [UIFont systemFontOfSize:14];;
    }
    return cell;
}
@end
